﻿using System;
using Lidgren.Network;

namespace Model.LiveControl
{
    public struct FormItemModel : ISerializable
    {
        public string ExeFormName;
        public int ScreenIndex;
        public string DeviceName;
        public IntPtr Ptr;

        public bool FlagOccupied;

        public void WritePayload(NetOutgoingMessage message)
        {
            message.Write(ExeFormName);
            message.Write(ScreenIndex);
            message.Write(DeviceName);
            message.Write(Ptr.ToInt32());
            message.Write(FlagOccupied);
        }

        public void ReadPayload(NetIncomingMessage message)
        {
            ExeFormName = message.ReadString();
            ScreenIndex = message.ReadInt32();
            DeviceName = message.ReadString();
            Ptr = new IntPtr(message.ReadInt32());
            FlagOccupied = message.ReadBoolean();
        }
    }
}